<?php

use Illuminate\Support\Facades\Form;
use Illuminate\Html\FormBuilder;
class PostType extends Eloquent
{
    protected $table = 'posttype';
    
    // 设置为false就不会添加create_at update_at
    public $timestamps = true;
    
    // 为空不保护集体赋值
    protected $guarded = [];

    
    //取得日志类型列表
    public static function getPostTypeList(){
        $data = [] ;
        foreach (PostType::all() as $k=>$v){
        	$data[$v->id] = $v->pname ;
        }
        return $data ;
    }
    
    /**
     * 正向 == 多对一
     */
    public function posts(){
    	return $this->hsaMany('Post', 'id') ;
    }
}